package com.zggk.lzz.roadh;

import android.util.Log;

import com.zggk.lzz.api.MyApplication;
import com.zggk.lzz.api.Urls;
import com.zggk.lzz.mvp.BasePresenterImpl;
import com.lzy.okgo.OkGo;
import com.lzy.okgo.callback.StringCallback;
import com.lzy.okgo.model.Response;

/**
 * MVPPlugin
 *  邮箱 784787081@qq.com
 */

public class RoadHPresenter extends BasePresenterImpl<RoadHContract.View> implements RoadHContract.Presenter{
    @Override
    public void setRoad(String data) {
        Log.e("测试",data);
        OkGo.<String>post(Urls.JAVASERVER+"pms/rhms/lzzapp/patrolStart")
                .params("data", data)
                .params("token", "Bearer$" + MyApplication.spUtils.getString("Token",""))
                .execute(new StringCallback() {
                    @Override
                    public void onSuccess(Response<String> response) {
//                        RoadZoneInfo roadZoneInfo = JSON.parseObject(response.body(),RoadZoneInfo.class);
//                        if (mView == null)
//                            return;
//                        if (roadZoneInfo.getCode().equals("200")){
//                            mView.setRoads(roadZoneInfo.getData());
//                        }else {
//                            mView.onRequestError(roadZoneInfo.getMessage());
//                        }
                    }
                });
    }
    @Override
    public void setRoad2(String data) {
        OkGo.<String>post(Urls.JAVASERVER+"pms/rhms/lzzapp/saveStateLonLat")
                .params("data", data)
                .params("token", "Bearer$" + MyApplication.spUtils.getString("Token",""))
                .execute(new StringCallback() {
                    @Override
                    public void onSuccess(Response<String> response) {
//                        RoadZoneInfo roadZoneInfo = JSON.parseObject(response.body(),RoadZoneInfo.class);
//                        if (mView == null)
//                            return;
//                        if (roadZoneInfo.getCode().equals("200")){
//                            mView.setRoads(roadZoneInfo.getData());
//                        }else {
//                            mView.onRequestError(roadZoneInfo.getMessage());
//                        }
                    }
                });
    }
}
